<template>
  <el-time-picker ref="compRef" v-model="value" v-bind="{ ...$props }">
    <template v-for="(_slot, slotName) in $slots" #[slotName]="slotProps">
      <slot :name="slotName" v-bind="slotProps" :key="slotName"></slot>
    </template>
  </el-time-picker>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { DatePickerProps } from "element-plus";
import { BaseTimePickerExpose } from "./types";
interface Props extends Partial<DatePickerProps> {}

/** 需要按照官网文档设置默认值，否则表现效果和官网文档的不一致 */
withDefaults(defineProps<Props>(), {
  editable: true,
  clearable: true,
  size: "default",
  type: "date",
  format: "YYYY-MM-DD HH:mm:ss",
  rangeSeparator: "-",
  validateEvent: true,
  teleported: true,
  placement: "bottom",
});

const value = defineModel();
const compRef = ref();

defineExpose<BaseTimePickerExpose>({
  // @ts-ignore
  instance: compRef,
});
</script>
<style lang="scss"></style>
